\subsection{Stokes' theorem}

Stokes' theorem says that in typical problems a surface integral can be
computed using a line integral.
(There is some fine print regarding continuity and boundary conditions.)
This is a useful theorem because usually the line integral is easier to
compute.
In rectangular coordinates the equivalence between a line integral
on the left and a surface integral on the right is
%
$$\oint P\,dx+Q\,dy+R\,dz
=\int\!\!\!\int_S(\mathop{\rm curl}{\bf F})\cdot{\bf n}\,d\sigma
$$
%
where ${\bf F}=(P,Q,R)$.
For $S$ parametrized by $x$ and $y$ we have
$${\bf n}\,d\sigma=\left(
\frac{\partial S}{\partial x}\times\frac{\partial S}{\partial y}
\right)dx\,dy$$

\noindent
Example:
Let ${\bf F}=(y,z,x)$ and let $S$ be the part of the paraboloid
$z=4-x^2-y^2$
that is above the $xy$ plane.
The perimeter of the paraboloid is the circle $x^2+y^2=2$.
The following script computes both the line and surface integrals.
Polar coordinates are used for the line integral so that \verb$defint$ can succeed.

{\color{blue}
\begin{verbatim}
"Surface integral"
F = (y,z,x)
S = (x,y,z)
f = dot(curl(F),cross(d(S,x),d(S,y)))
x = r cos(theta)
y = r sin(theta)
defint(f r,r,0,2,theta,0,2 pi)
"Line integral"
x = 2 cos(t)
y = 2 sin(t)
z = 4 - x^2 - y^2
P = y
Q = z
R = x
f = P d(x,t) + Q d(y,t) + R d(z,t)
f = circexp(f)
defint(f,t,0,2 pi)
\end{verbatim}
}

\noindent
This is the result when the script runs.
Both the surface integral and the line integral
yield the same result, $-4\pi$.

\bigskip
\noindent
Surface integral

\noindent
$\displaystyle -4\pi$

\noindent
Line integral

\noindent
$\displaystyle -4\pi$
